package com.zqxq.lottery.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 说    明：   Api文档接口
 * 创 建 人：	一刀·胡
 * 创建时间：	2018/3/16 10:47
 * 修 改 人：
 * 修改日期：
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket riskDataSourceApi(){
        return new Docket(DocumentationType.SPRING_WEB)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zqxq.lottery.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("战国竞猜API接口文档")
                .description("战国竞猜")
                .termsOfServiceUrl("http://www.newzqxq.com/")
                .contact(new Contact("战国竞猜", "", "hyd@newzqxq.com"))
                .version("1.0")
                .build();
    }
}
